home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / utilities / easyproc2.lha / EasyProcess / launch / IsParent.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-05  |  1.1 KB  |  53 lines

  1. #include "Launch.h"
  2. #include "LaunchPriv.h"
  3.  
  4.  
  5. /*
  6.  *    NAME
  7.  *        IsParent -- verifies if the process is a parent to another one.
  8.  *
  9.  *    SYNOPSIS
  10.  *        pp = IsParent (Proc)
  11.  *
  12.  *        struct ProcPair *IsParent (struct Process *);
  13.  *
  14.  *    FUNCTION
  15.  *        Check if the process has started a child process and if the
  16.  *        child is still active.
  17.  *
  18.  *    DESCRIPTION
  19.  *        Scan the process pair linked list for a pair which is has the
  20.  *        input process as the parent.  If it find one, return a pointer
  21.  *        to it.
  22.  *
  23.  *    INPUT
  24.  *        Proc - a pointer to the process to be checked.
  25.  *
  26.  *    OUTPUT
  27.  *        pp - a ProcPair structure pointer.
  28.  *
  29.  *    NOTE
  30.  *        Assume Forbid() has been called to make sure the list is not
  31.  *        modified while we scan it.
  32.  *
  33.  *    HISTORY
  34.  *        1992/09/06    Pierre Baillargeon        Creation
  35.  *
  36.  *    SEE ALSO
  37.  *        IsChild()
  38.  */
  39.  
  40. struct ProcPair *IsParent (struct Process *Proc)
  41. {
  42.     struct ProcPair *pp;
  43.     if (NULL != ProcPairList)
  44.     {
  45.         for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
  46.         {
  47.             if (Proc == pp->pp_Parent)
  48.                 return pp;
  49.         }
  50.     }
  51.     return NULL;
  52. }
  53.